// ANSWER: 5437849

#include <iostream>
#include <vector>

void solve_problem_216()
{
#if 1
	//const int N = 9;
	//const int N = 10000;
	const int N = 10000000;
#else
	const int N = 50000000;
#endif

	std::vector<long long> t(N+1);
	for (int n = 0; n <= N; n++)
	{
		t[n] = 2LL*n*n - 1;
	}

	int count = 0;
	for (int n = 1; n <= N; n++)
	{
		if (t[n] > 1)
		{
			if (t[n] == 2LL*n*n - 1)
				++count;
			long long p = t[n];

			// m == n (mod p)
			for (long long m = n + p; m <= N; m += p)
			{
				do
				{
					t[m] /= p;
				}
				while (t[m] % p == 0);
			}

			// m == p - n (mod p)
			for (long long m = p - n; m <= N; m += p)
			{
				do
				{
					t[m] /= p;
				}
				while (t[m] % p == 0);
			}
		}
	}

	std::cout << count << std::endl;
}
